Accept-Encoding通常用來表示客戶端針對即將返回的Response Body可能知道的內容編碼形式,通常為壓縮演算法,如同Accept
也可以加上一些權重的標示。
伺服器端有可能不會回傳壓縮過的Response Body,主要原因為
GET /ironman?tab=hot HTTP/1.1
Host: ithelp.ithome.com.tw
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4,pt;q=0.2
Cookie: (略)
以第8屆鐵人賽熱門文章頁面來看,客戶端可能知道的內容編碼形式gzip, deflate, sdch
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Encoding: gzip
Content-Type: text/html; charset=UTF-8
Date: Mon, 26 Dec 2016 13:35:44 GMT
Server: nginx/1.4.6 (Ubuntu)
Set-Cookie: (略)
Set-Cookie: (略)
Content-Length: 7340
Connection: keep-alive
Response Body對應的Content-Encoding
為gzip